    'Defines
    HMODE_DEFAULT = 0
    HMODE_ROUTE = 1
    VMODE_GLIDE = 0
    VMODE_THROTTLE = 1
    
    'Waypoints
    WP_HOME = 1
    WP_STDBY = 2
    WP_1 = 3
    WP_2 = 4
    WP_MOB = 5
    WP_S1 = 6
    WP_S2 = 7
    WP_AF = 8
    WP_TD = 9
    WP_BASELEG = 10
    WP_CLIMB = 11
    waypoint WP_HOME,   0, 0, 75           'home
    waypoint WP_STDBY,  49.5, 100.1, 75    'stdby
    waypoint WP_1,      10.1, 189.9, 75    '1
    waypoint WP_2,      132.3, 139.1, 75   '2
    waypoint WP_MOB,    137.0, -11.6, 75   'mob
    waypoint WP_S1,     -119.2, 69.6, 75   's1
    waypoint WP_S2,     274.4, 209.5, 75   's2
    waypoint WP_AF,     177.4, 45.1, 75    'af
    waypoint WP_TD,     28.8, 57.0, 0.0    'td
    waypoint WP_BASELEG, 168.8, -13.8, 75  'baseleg
    waypoint WP_CLIMB,  -114.5, 162.3, 75  'climb

    'Wait for GPS
    kill_throttle 1
    WaitGPSValid

    'Geo init
    sleep 10
    NavSetGroundReferenceHere

    'Holding point
    kill_throttle 1
    set_attitude 0, 0, VMODE_THROTTLE

    'Takeoff
    kill_throttle 0
    set_estimator_flight_time 0
    On altitude > ground_alt+25 GoTo 110
    go WP_HOME, 1.0, HMODE_DEFAULT, VMODE_THROTTLE, WP_CLIMB, 15

    'Standby
110 Circle nav_radius, WP_STDBY

    'Figure 8 around wp 1
120 eight 1, nav_radius, WP_1

    'Oval 1-2
130 oval 1, 2, nav_radius

    'MOB
140 NavSetWaypointHere WP_MOB
    nav_radius = DEFAULT_CIRCLE_RADIUS
    Circle nav_radius, WP_MOB

    'Line 1-2
150 On datalink_time > 22 GoTo 110
    nav_line_init
    nav_line(WP_1, WP_2, nav_radius)

    'Survey S1-S2
160 survey_rectangle 150, WP_S1, WP_S2

    'Land Right AF-TD
170 nav_radius = DEFAULT_CIRCLE_RADIUS
    GoTo 190

    'Land Left AF-TD
180 nav_radius = -DEFAULT_CIRCLE_RADIUS
    GoTo 190

    'land
190 nav_compute_baseleg WP_AF, WP_TD, WP__BASELEG, nav_radius
    On NavCircleCount() > 0.5 GoTo 200
    Circle nav_radius, WP_BASELEG
200 On NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10) And 10 > Abs(estimator_z - WaypointAlt(WP_BASELEG)) GoTo 210
    Circle nav_radius, WP_BASELEG

    'final
210 On ground_alt + 10 > estimator_z GoTo 220
    go WP_AF, 1.0, HMODE_ROUTE, VMODE_GLIDE, WP_TD

    'flare
220 go WP_AF, 1.0, HMODE_ROUTE, VMODE_GLIDE, WP_TD
    attitude 0.0, 0.0, VMODE_THROTTLE
